<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title></title>
    <link rel="stylesheet" type="text/css" href="css/common.css" />
    <script src="js/common.js" type="text/javascript" charset="utf-8"></script>
  </head>

  <body>
    <button>开灯</button>
    <img src="https://s1.ax1x.com/2022/05/25/XiHhmq.png" />
  </body>

  <script type="text/javascript">
    var btn = document.querySelector('button')
    var img = document.querySelector('img')

    btn.onclick = function () {
      if (btn.value == '开灯') {
        img.src = 'https://s1.ax1x.com/2022/05/25/XiHokT.png'
        btn.value = '关灯'
      } else {
        img.src = 'https://s1.ax1x.com/2022/05/25/XiHhmq.png'
        btn.value = '开灯'
      }
    }
  </script>
</html>
